package cc.vv.btpartyjob.partymanager.delegate

import android.annotation.SuppressLint
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.btpartyjob.partymanager.inter.LookBigPicFileInterface
import cc.vv.btpartyjob.partymanager.moudel.bean.XzcDangZuZhiPicObj
import cc.vv.btpartyjob.partymanager.moudel.bean.XzcSizhiDuiWuObj
import cc.vv.btpartyjob.partymanager.view.PicFileShowView
import cc.vv.btpartyjob.partymanager.view.XzcManagerView
import cc.vv.mvp.delegate.BaseAppDelegate
import java.util.*

/**
 * 新镇村管理托管类
 * Created by Chen.qi on 2018/10/24.
 */
@SuppressLint("SetTextI18n")
class XingZhenCunManagerActivityDelegate : BaseAppDelegate() {

    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_xingzhen_cun_manager_info
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String?) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_axcMi_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_axcMi_topBar)
        titleBar?.setEventInterface(event)
    }


    /**
     * 设置人口数量
     */
    fun setXZRenKou(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_axcMi_renKouNum)
        viewStr?.text = "$str 户"
    }

    /**
     * 设置面积
     */
    fun setXZGengDiMianJi(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_axcMi_gengDiMianji)
        viewStr?.text = "$str 平方千米"
    }

    /**
     * 设置主导产业
     */
    fun setXZZhuDaoChanYe(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_axcMi_zhuDaoChanYe)
        viewStr?.text = str
    }

    /**
     * 设置贫困数量
     */
    fun setXZPingKunNum(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_axcMi_pinKunNum)
        viewStr?.text = "$str 户"
    }

    /**
     * 设置党员数量
     */
    fun setPartyNum(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_axcMi_dangYuanNum)
        viewStr?.text = "$str 人"
    }

    /**
     * 设置党员数量
     */
    fun setXZShiFouTuoPing(str: Int?) {
        val viewStr = getView<TextView>(R.id.tv_axcMi_shiFouTuoPing)
        if (str == 0) {
            viewStr?.text = "否"
        } else if (str == 1) {
            viewStr?.text = "是"
        }
    }

    /**
     * 第一书记
     */
    fun setDiYiShuJiList(list: ArrayList<XzcSizhiDuiWuObj>?) {
        val llDyShuJiView = getView<LinearLayout>(R.id.ll_axcMi_diyiShuji)
        if (null != list && list.size > 0) {
            llDyShuJiView?.visibility = View.VISIBLE
            getView<XzcManagerView>(R.id.xmv_axcMi_diyiShuji)?.addAllSelectedFileView(list)
        } else {
            llDyShuJiView?.visibility = View.GONE
        }
    }


    /**
     * 扶贫工作队
     */
    fun setFuPingWorkList(list: ArrayList<XzcSizhiDuiWuObj>?) {
        val llView = getView<LinearLayout>(R.id.ll_axcMi_fupingWork)
        if (null != list && list.size > 0) {
            llView?.visibility = View.VISIBLE
            getView<XzcManagerView>(R.id.xmv_axcMi_fupingWork)?.addAllSelectedFileView(list)
        } else {
            llView?.visibility = View.GONE
        }
    }

    /**
     * 驻村干部
     */
    fun setZhuCunGanBuList(list: ArrayList<XzcSizhiDuiWuObj>?) {
        val llView = getView<LinearLayout>(R.id.ll_axcMi_zhuCunGanBu)
        if (null != list && list.size > 0) {
            llView?.visibility = View.VISIBLE
            getView<XzcManagerView>(R.id.xmv_axcMi_zhuCunGanBu)?.addAllSelectedFileView(list)
        } else {
            llView?.visibility = View.GONE
        }
    }

    /**
     * 村两委班子
     */
    fun setCunLiangWeiBanZiList(list: ArrayList<XzcSizhiDuiWuObj>?) {
        val llView = getView<LinearLayout>(R.id.ll_axcMi_cunLiangWeiBZ)
        if (null != list && list.size > 0) {
            llView?.visibility = View.VISIBLE
            getView<XzcManagerView>(R.id.xmv_axcMi_cunLiangWeiBZ)?.addAllSelectedFileView(list)
        } else {
            llView?.visibility = View.GONE
        }
    }

    /**
     * 党组织照片
     */
    fun setDangZuZhiPic(list: ArrayList<String>?, selectedImageInter: LookBigPicFileInterface) {
        val llView = getView<LinearLayout>(R.id.ll_axcMi_dangZuZhiPic)
        if (null != list && list.size > 0) {
            llView?.visibility = View.VISIBLE
            val viewPic = getView<PicFileShowView>(R.id.xmv_axcMi_dangZuZhiPic)
            viewPic?.setSelectedImageInter(selectedImageInter)
            viewPic?.addAllSelectedFileView(list, 3)
        } else {
            llView?.visibility = View.GONE
        }
    }
}